import yaml


class ReadConf:
    def __init__(self, filepath):
        self.filepath = filepath

    def read_yaml(self):
        """
        读取单组数据
        :return:
        """
        with open(self.filepath, 'r', encoding='utf-8') as f:
            res = yaml.load(f.read(), Loader=yaml.FullLoader)
        return res

    def read_all_yaml(self):
        """
        读取多组数据
        :return:
        """
        with open(self.filepath, 'r', encoding='utf-8') as f:
            res = yaml.load_all(f.read(), Loader=yaml.FullLoader)
            return res
